package top.hidoctor.auscultation.feature.fragment;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import top.hidoctor.auscultation.R;
import top.hidoctor.auscultation.adapter.YishengAdapter;
import top.hidoctor.auscultation.adapter.YishengBzAdapter;
import top.hidoctor.auscultation.base.BaseFragment;
import top.hidoctor.auscultation.bean.LableBean;

public class YishengFragment extends BaseFragment {

    private RecyclerView rcYisheng;
    private YishengBzAdapter adapter;
    private List<LableBean.LabelUserSamplesBean> list = new ArrayList<>();


    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_yisheng, container, false);
        return view;
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        LableBean bean = (LableBean) getArguments().getSerializable("info");
        list.addAll(bean.getLabelUserSamples());
        initView();
    }

    private void initView() {
        rcYisheng = getActivity().findViewById(R.id.rc_yisheng);
        rcYisheng.setLayoutManager(new LinearLayoutManager(getContext()));
        rcYisheng.setAdapter(adapter = new YishengBzAdapter(R.layout.item_yisheng, list));
        View view = LayoutInflater.from(getContext()).inflate(R.layout.layout_empty_list, (ViewGroup) rcYisheng.getParent(), false);
        adapter.setEmptyView(view);
    }
}
